# -*- coding: utf-8 -*-
"""
@Time ： 2024/6/7 17:11
@Auth ： 李天天
"""
import socket


def start_server(port):
    server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    server_socket.bind(('0.0.0.0', port))
    server_socket.listen(5)
    print(f"Server started on port {port}")
    while True:
        client_socket, addr = server_socket.accept()
        print(f"Connection from {addr}")
        client_socket.sendall(b'HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\nHello World')
        client_socket.close()


if __name__ == "__main__":
    port = 32976  # 替换为你想要占用的端口
    start_server(port)
